package com.augus.admin.service.Impl;


import com.augus.admin.bean.TUserRole;
import com.augus.admin.mapper.TUserRoleMapper;
import com.augus.admin.service.TUserRoleService;
import io.micrometer.core.instrument.Counter;
import io.micrometer.core.instrument.MeterRegistry;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class TUserRoleServiceImpl implements TUserRoleService {
  @Autowired
  TUserRoleMapper tUserRoleMapper;

  // 指标统计
  Counter counter;

  public TUserRoleServiceImpl(MeterRegistry meterRegistry) {
    counter = meterRegistry.counter("cityService.saveCity.count");
  }

  public TUserRole getById(Integer id) {
    return tUserRoleMapper.getById(id);
  }

  public void saveTUserRole(TUserRole tUserRole) {
    counter.increment(); // 每次调用增加1
    tUserRoleMapper.insert(tUserRole);
  }
}
